#include"ser.h"
int main(int argc, const char *argv[])
{
	int fd=socket(AF_INIT,SOCK_STREAM,0);
	int ret=-1;
	if(fd<0){
	perror("socket");
	return fd;
	}
	struct sock_addr sini,cin;
	bzero(&cin,sizeof(cin));
	sin.sin_family=AF_INIT;
	sin.sin_port=htons("66666");
	sin.sin_addr.s_addr=inet_addr(IP);
	ret=bind(fd,(void*)&sin,sizeof(sin));
	if(ret<0){
	perror("bind");
	return ret;
	}
	listen(fd,10);
	printf("服务器准备就绪\n");
	while(1){
	int new=accept(fd,(void*)&cin,sizeof(cin));
	if(new<0){
	perror("accept");
	return new;
	}
	printf("接受 %s ,端口号：%d 客户端接受成功\n",inet_ntoa(cin.sin_addr),ntohs(cin.sin_port));

	int pid=fork();
	if(pid<0){
	perror("fork");
	return pid;
	}else if(pid==0){
	//子进程
	
	}
	else{
	//父进程
	
	}
	
	}





	return 0;
}
